home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char rcsid[] = "$Header: xmove.c,v 1.5 87/03/31 17:41:49 schoch Exp $";
- #endif
-
- #include "externs.h"
-
- domove(from, to)
- {
-
- if (whose[from] != ourcolor) {
- fprintf(stderr, "Moving wrong piece: %d at %d\n", whose[from], from);
- return;
- }
- if (inp == NULL) {
- message("Sorry, lost your opponent.", MESSAGE);
- return;
- }
- fprintf(out, "%1c%1d-%1c%1d\r\n", from%10-1+'a', 9-from/10,
- to%10-1+'a', 9-to/10);
- if (movetry(from, to, ourcolor))
- return;
- if (ghost[to]) { /* "capture" a ghost */
- ghost_capture(to);
- ghost[to] = 0;
- }
- }
-
- ghost_capture(p)
- {
- display_capture(theircolor, ghost[p]);
- }
-
- display_capture(color, piece)
- u_char color, piece;
- {
- int i;
- int n;
-
- if (color == WHITE)
- n = 0;
- else
- n = 16;
- for (i = 0; i < 16; i+=2)
- if (captured[n+i] == 0)
- break;
- if (i >= 16)
- for (i = 1; i < 16; i+=2)
- if (captured[n+i] == 0)
- break;
- if (i >= 16) {
- fprintf(stderr, "panic: can't find capture space.\n");
- exit(1);
- }
- captured[i+n] = piece;
- redraw_captured(i+n);
- }
-